package com.huanbao.nongwu.service;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.huanbao.nongwu.dao.DeviceDocDao;
import com.huanbao.nongwu.pojo.SysUserVO;
import com.huanbao.nongwu.pojo.beans.DeviceDoc;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Map;

/* ━━━━━━佛祖保佑━━━━━━
 *                  ,;,,;
 *                ,;;'(    社
 *      __      ,;;' ' \   会
 *   /'  '\'~~'~' \ /'\.)  主
 * ,;(      )    /  |.     义
 *,;' \    /-.,,(   ) \    码
 *     ) /       ) / )|    农
 *     ||        ||  \)
 *     (_\       (_\
 * ━━━━━━永无BUG━━━━━━
 * @author ：zjq
 * @date ：2021/3/25 10:43
 * @description: TODO
 * @version: V1.0
 * @slogan: 天下风云出我辈，一入代码岁月催
 */
@Service
public class DeviceDocServiceImpl {

    @Autowired
    private DeviceDocDao deviceDocMapper;


    public PageInfo<DeviceDoc> selectByPaingAndCondition(Map<String, Object> map) {

        int pageNum = (int) map.get("pageNum");
        int pageSize = (int) map.get("pageSize");

        PageHelper.startPage(pageNum, pageSize);
        int sewageid = (int) map.get("sewageid");
        QueryWrapper<DeviceDoc> emp = new QueryWrapper<>();
        emp.eq("sewageid", sewageid);
        List<DeviceDoc> deviceDocs = deviceDocMapper.selectList(emp);
        PageInfo<DeviceDoc> pageInfo = new PageInfo(deviceDocs);
        return pageInfo;

    }


    public int deleteBySewageid(int sewageid) {
        QueryWrapper<DeviceDoc> emp = new QueryWrapper<>();
        emp.eq("sewageid", sewageid);

        return deviceDocMapper.delete(emp);
    }

    public int insertSelective(DeviceDoc record) {
        return deviceDocMapper.insert(record);
    }


}
